from django.db import models

# Create your models here.
"""
1、py manage.py makemigrations polls 创建迁移文件
会存储到 migrations/下

2、py manage.py sqlmigrate polls 0001  该命令会返回一个创建的SQL语句

3、py manage.py migrate 迁移命令会在数据库里创建表
"""


class Question(models.Model):
    """
    问题模型
    """
    question_text = models.CharField(max_length=200)
    pub_date = models.DateTimeField('date published')


class Choice(models.Model):
    """
    选项模型
    """
    question = models.ForeignKey(Question, on_delete=models.CASCADE)
    choice_text = models.CharField(max_length=200)
    votes = models.IntegerField(default=0)
